package com.credithc.customers.manager.echarts;

import com.credithc.customers.manager.po.CustomerProductPiePo;
import com.github.abel533.echarts.code.RoseType;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhukai
 * @date 2019/1/23 14:47
 */
public class CustomerProductStatsPie extends EChartsCommon {

    private static List<String> rowList = new ArrayList<>();

    static {
        rowList.add("金额");
    }

    public CustomerProductStatsPie(List<CustomerProductPiePo> pos, List<String> colList) {
        super(rowList, colList);
        for (CustomerProductPiePo po : pos) {
            setValue(po.getProductType(),po.getAmount());
        }
    }

    public String generateGraph() {
        String str = createGraph(null, null).createPie("金额", "50%", "50%", "50%").setPieType(RoseType.area).createOutsideLabel().createBottomLegend(columnList).toJSONString();
        return str;
    }
}

